<template>
  <div class="newsinfo-container">
      <h3 class="title">{{newinfo.title}}</h3>
      <p class="p">
          <span>发表时间:{{newinfo.add_time |fordata}}</span>
          <span>点击：{{newinfo.click}}</span>
      </p>
      <hr>
      <div class="contain" v-html="newinfo.content">
          
      </div>
      <comment :id="id"></comment>
  </div>
</template>
<script>
import comment from '../comment/comment.vue'
export default {
  data() {
    return {
      newinfo: {}
    };
  },
  methods: {
    async getinfo() {
      const { data } = await this.$http.get("/api/getnew/" + this.id);
      if (data.status === 0) {
        this.newinfo = data.message[0];
        //console.log(data.message);
      }
    }
  },
  created() {
    this.getinfo();
  },
  components:{
      comment
  },
  props: ["id"]
};
</script>
<style lang="scss">
.newsinfo-container {
    padding: 0 8px;
  .title {
    font-size: 16px;
    text-align: center;
    margin: 15px 0;
    color: red;
  }
 .p{
      display: flex;
      justify-content: space-between;
      color:#26a2ff;
  }
}
 
</style>


